library AttentionCommand initializer init requires LegacySystem

	private function AttentionActions takes nothing returns nothing
		local integer i = GetConvertedPlayerId(GetTriggerPlayer())
		local effect e
		local integer current = udg_Second
		if current-udg_Attention[i]==0 then
			if current-udg_AttentionLimit==0 then
				set udg_AttentionLimit = current
				set e = null
				return
			endif
			if GetWidgetLife(udg_Hero[i])>0.405 then
				set e = AddSpecialEffectTarget("Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl", udg_Hero[i], "overhead")
			elseif GetWidgetLife(udg_Pet[i])>0 then
				set e = AddSpecialEffectTarget("Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl", udg_Pet[i], "overhead")
			endif
			if udg_FPSMode[i] then
				set udg_RotationLock[i] = not(udg_RotationLock[i])
			endif
			call PolledWait(3.)
			call DestroyEffect(e)
		else
			set udg_Attention[i] = current
		endif
		set e = null
	endfunction

	//===========================================================================
	private function init takes nothing returns nothing
		local trigger t 
		local integer i = 0
		set t = CreateTrigger()
		loop
			exitwhen i > 11
			call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_END_CINEMATIC)
			set i = i + 1
		endloop
		call TriggerAddAction(t,function AttentionActions)
	endfunction

endlibrary